package com.sample.action;
/**
 * 就诊信息action
 */
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.sample.action.form.MxillmessageForm;
import com.sample.javabean.Mxillmessage;
import com.sample.util.Pager;


public class MxillmessageAction extends BaseAction {

	private static final long serialVersionUID = -2850857174121299807L;
	private final static Log log = LogFactory.getLog(MxillmessageAction.class);
	private Pager<Mxillmessage> pageList;
	private String doctorid;
	private Mxillmessage mxillmessage = new Mxillmessage();
	private MxillmessageForm mxillmessageForm = new MxillmessageForm();

	/**
	 * 添加
	 * @return
	 * @throws Exception
	 */
	public String inputMxillmessage() throws Exception {

		return "inputMxillmessage";
	}

	public String save() throws Exception {
		try {
			log.info("保存就诊信息");
			// Form属性接值，由struts2框架自动完成属性值注入
			if (mxillmessageForm != null) {
				Mxillmessage mxillmessage = new Mxillmessage();
				// 将Form中的属性值一一赋予illmessage的对应的属性。
				mxillmessage.setDoctorid(mxillmessageForm.getDoctorid());
				mxillmessage.setCardNo(mxillmessageForm.getCardNo());
				mxillmessage.setIllname(mxillmessageForm.getIllname());
				mxillmessage.setHospital(mxillmessageForm.getHospital());
				mxillmessage.setIlltime(mxillmessageForm.getIlltime());
				mxillmessage.setMoney(mxillmessageForm.getMoney());

				// 调用add方法
				mxillmessage.add();
			}
			return SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();

		}
		return "inputMxillmessage";
	}
/**
 * 显示
 * @return
 * @throws Exception
 */
	public String list() throws Exception {
		Mxillmessage mxillmessageModel = new Mxillmessage();
		pageList = mxillmessageModel.list(page, size, mxillmessageForm);
		return "listMxillmessage";
	}
/**
 * 删除
 * @return
 * @throws Exception
 */
	public String del() throws Exception {
		try {
			if (mxillmessageForm != null) {
				mxillmessage.setDoctorid(doctorid);
				mxillmessage.delMxillmessage();
			}
			return SUCCESS;
		} catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
	}
	/**
	 * 编辑
	 * @return
	 * @throws Exception
	 */
	public String editMxillmessage()throws Exception{
		try{
			mxillmessage.setDoctorid(doctorid);
			mxillmessage.load();
			return "editMxillmessage";
		}catch (Exception e) {
			e.printStackTrace();
			throw e;
		}	
	}
	public String edit()throws Exception{
		try{
			if(mxillmessageForm!=null){
				mxillmessage.setDoctorid(mxillmessageForm.getDoctorid());
				mxillmessage.setCardNo(mxillmessageForm.getCardNo());
				mxillmessage.setIllname(mxillmessageForm.getIllname());
				mxillmessage.setHospital(mxillmessageForm.getHospital());
				mxillmessage.setIlltime(mxillmessageForm.getIlltime());
				mxillmessage.setMoney(mxillmessageForm.getMoney());
				mxillmessage.editMxillmessage();	
			}
			return SUCCESS;
		}catch (Exception e) {
			e.printStackTrace();
			throw e;
		}	
	}

	public Pager<Mxillmessage> getPageList() {
		return pageList;
	}

	public void setPageList(Pager<Mxillmessage> pageList) {
		this.pageList = pageList;
	}

	public String getDoctorid() {
		return doctorid;
	}

	public void setDoctorid(String doctorid) {
		this.doctorid = doctorid;
	}

	public Mxillmessage getMxillmessage() {
		return mxillmessage;
	}

	public void setMxillmessage(Mxillmessage mxillmessage) {
		this.mxillmessage = mxillmessage;
	}

	public MxillmessageForm getMxillmessageForm() {
		return mxillmessageForm;
	}

	public void setMxillmessageForm(MxillmessageForm mxillmessageForm) {
		this.mxillmessageForm = mxillmessageForm;
	}
	

}
